from __future__ import absolute_import, division

from ..base import *


class WindowEvent(PandaEvent):
    id =_ ('window-event')
    
    screen = Attribute()
    
    def handle(self, window):
        if window is None:
            return
        
        properties = window.getProperties()
        
        if (self.screen.pixel_width  == properties.getXSize() and
            self.screen.pixel_height == properties.getYSize()):
            return
        
        self.screen.pixel_size = (properties.getXSize(), properties.getYSize())
        self.screen.update_alignments()
